🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / settings / src / commonTest / kotlin / org / meshtastic / feature / settings / radio / component / EditDeviceProfileDialogTest.kt
Displaying Raw • Download
feature/settings/src/commonTest/kotlin/org/meshtastic/feature/settings/radio/component/EditDeviceProfileDialogTest.kt 2d20cd8a4708e2ef66e98d5259f3a97ec93f240a (2d20cd8a) Text, 3.73 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.settings.radio.component
Tff7b72import T7ee787androidx.compose.ui.test.ExperimentalTestApi
Tff7b72import T7ee787androidx.compose.ui.test.assertIsDisplayed
Tff7b72import T7ee787androidx.compose.ui.test.onNodeWithText
Tff7b72import T7ee787androidx.compose.ui.test.performClick
Tff7b72import T7ee787androidx.compose.ui.test.v2.runComposeUiTest
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.cancel
Tff7b72import T7ee787org.meshtastic.core.resources.getString
Tff7b72import T7ee787org.meshtastic.core.resources.save
Tff7b72import T7ee787org.meshtastic.proto.DeviceProfile
Tff7b72import T7ee787org.meshtastic.proto.Position
Tff7b72import T7ee787kotlin.test.Test
Tff7b72import T7ee787kotlin.test.assertEquals
Tff7b72import T7ee787kotlin.test.assertTrue
Tf0883e@OptInTb4b4b4(Te6edf3ExperimentalTestApiTff7b72::Te6edf3classTb4b4b4)
Tff7b72class T56d364EditDeviceProfileDialogTest Tb4b4b4{
Tff7b72private Tff7b72val Te6edf3title Tff7b72= Ta5d6ff"Ta5d6ffExport configurationTa5d6ff"
Tff7b72private Tff7b72val Te6edf3deviceProfile Tff7b72=
Te6edf3DeviceProfileTb4b4b4(
Te6edf3long_name Tff7b72= Ta5d6ff"Ta5d6ffLong nameTa5d6ff"Tb4b4b4,
Te6edf3short_name Tff7b72= Ta5d6ff"Ta5d6ffShort nameTa5d6ff"Tb4b4b4,
Te6edf3channel_url Tff7b72= Ta5d6ff"Ta5d6ffhttps://meshtastic.org/e/#CgMSAQESBggBQANIAQTa5d6ff"Tb4b4b4,
Te6edf3fixed_position Tff7b72= Te6edf3PositionTb4b4b4(Te6edf3latitude_i Tff7b72= T79c0ff3T79c0ff2T79c0ff7T79c0ff7T79c0ff6T79c0ff6T79c0ff6T79c0ff5T79c0ff0Tb4b4b4, Te6edf3longitude_i Tff7b72= Tff7b72-T79c0ff9T79c0ff6T79c0ff7T79c0ff9T79c0ff6T79c0ff9T79c0ff8T79c0ff9T79c0ff0Tb4b4b4, Te6edf3altitude Tff7b72= T79c0ff1T79c0ff3T79c0ff8Tb4b4b4)Tb4b4b4,
Tb4b4b4)
Tf0883e@Test
Tff7b72fun Td2a8fftestEditDeviceProfileDialog_showsDialogTitleTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runComposeUiTest Tb4b4b4{
Te6edf3setContent Tb4b4b4{
Te6edf3EditDeviceProfileDialogTb4b4b4(Te6edf3title Tff7b72= Te6edf3titleTb4b4b4, Te6edf3deviceProfile Tff7b72= Te6edf3deviceProfileTb4b4b4, Te6edf3onConfirm Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4, Te6edf3onDismiss Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4)
Tb4b4b4}
T8b949e// Verify that the dialog title is displayed
Te6edf3onNodeWithTextTb4b4b4(Te6edf3titleTb4b4b4)Tb4b4b4.Te6edf3assertIsDisplayedTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tf0883e@Test
Tff7b72fun Td2a8fftestEditDeviceProfileDialog_showsCancelAndSaveButtonsTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runComposeUiTest Tb4b4b4{
Te6edf3setContent Tb4b4b4{
Te6edf3EditDeviceProfileDialogTb4b4b4(Te6edf3title Tff7b72= Te6edf3titleTb4b4b4, Te6edf3deviceProfile Tff7b72= Te6edf3deviceProfileTb4b4b4, Te6edf3onConfirm Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4, Te6edf3onDismiss Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4)
Tb4b4b4}
T8b949e// Verify the "Cancel" and "Save" buttons are displayed
Te6edf3onNodeWithTextTb4b4b4(Te6edf3getStringTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3cancelTb4b4b4)Tb4b4b4)Tb4b4b4.Te6edf3assertIsDisplayedTb4b4b4(Tb4b4b4)
Te6edf3onNodeWithTextTb4b4b4(Te6edf3getStringTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3saveTb4b4b4)Tb4b4b4)Tb4b4b4.Te6edf3assertIsDisplayedTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tf0883e@Test
Tff7b72fun Td2a8fftestEditDeviceProfileDialog_clickCancelButtonTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runComposeUiTest Tb4b4b4{
Tff7b72var Te6edf3onDismissClicked Tff7b72= Tff7b72false
Te6edf3setContent Tb4b4b4{
Te6edf3EditDeviceProfileDialogTb4b4b4(
Te6edf3title Tff7b72= Te6edf3titleTb4b4b4,
Te6edf3deviceProfile Tff7b72= Te6edf3deviceProfileTb4b4b4,
Te6edf3onConfirm Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Te6edf3onDismiss Tff7b72= Tb4b4b4{ Te6edf3onDismissClicked Tff7b72= Tff7b72true Tb4b4b4}Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
T8b949e// Click the "Cancel" button
Te6edf3onNodeWithTextTb4b4b4(Te6edf3getStringTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3cancelTb4b4b4)Tb4b4b4)Tb4b4b4.Te6edf3performClickTb4b4b4(Tb4b4b4)
T8b949e// Verify onDismiss is called
Te6edf3assertTrueTb4b4b4(Te6edf3onDismissClickedTb4b4b4)
Tb4b4b4}
Tf0883e@Test
Tff7b72fun Td2a8fftestEditDeviceProfileDialog_addChannelsTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3runComposeUiTest Tb4b4b4{
Tff7b72var Te6edf3actualDeviceProfileTb4b4b4: Te6edf3DeviceProfile? Tff7b72= Tff7b72null
Te6edf3setContent Tb4b4b4{
Te6edf3EditDeviceProfileDialogTb4b4b4(
Te6edf3title Tff7b72= Te6edf3titleTb4b4b4,
Te6edf3deviceProfile Tff7b72= Te6edf3deviceProfileTb4b4b4,
Te6edf3onConfirm Tff7b72= Tb4b4b4{ Te6edf3actualDeviceProfile Tff7b72= Tffa657it Tb4b4b4}Tb4b4b4,
Te6edf3onDismiss Tff7b72= Tb4b4b4{Tb4b4b4}Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
Te6edf3onNodeWithTextTb4b4b4(Te6edf3getStringTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3saveTb4b4b4)Tb4b4b4)Tb4b4b4.Te6edf3performClickTb4b4b4(Tb4b4b4)
T8b949e// Verify onConfirm is called with the correct DeviceProfile
Te6edf3assertEqualsTb4b4b4(Te6edf3deviceProfileTb4b4b4, Te6edf3actualDeviceProfileTb4b4b4)
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.07s